#ifndef VIDEORECORDER_CV_H
#define VIDEORECORDER_CV_H

#include <QObject>
#include <opencv4/opencv2/opencv.hpp>

#include "baserecorder.h"

/**
 * @brief 编码器使用OpenCV
 * 
 */
class VideoRecorder_CV : public BaseRecorder {
  Q_OBJECT
 public:
  explicit VideoRecorder_CV(QObject *parent = nullptr);

  // 打开文件
  bool openFile(const QString &basename) override;

 public slots:
  // 图像接收
  void onImage(std::shared_ptr<QImage> img) override;

 private:
  //  QImage 转 Mat
  void pixmap2Mat(QImage *img, cv::Mat *mat);

 signals:

 private:
  cv::VideoWriter m_writer;
};

#endif  // VIDEORECORDER_CV_H
